package com.infoland.afanmall.model.fuPin.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.infoland.afanmall.R;
import com.infoland.afanmall.base.util.ToolsKit;
import com.infoland.afanmall.model.fuPin.entity.FuPinCunResponse;

import java.util.List;

/**
 * @author 王永吉
 * @date 2018/7/2 15:06
 * 扶贫村适配器
 */
public class FpCunActivityAdapter extends BaseQuickAdapter<FuPinCunResponse.ObjectBean.ListBean, BaseViewHolder> {
    public FpCunActivityAdapter(int layoutResId, @Nullable List<FuPinCunResponse.ObjectBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FuPinCunResponse.ObjectBean.ListBean item) {
        ToolsKit.setImgView(item.getF_url(), helper.getView(R.id.fu_pin_cun_img));
        helper.setText(R.id.fu_pin_cun_txt1, item.getName());
        for (FuPinCunResponse.ObjectBean.ListBean.ContextBean contextBean : item.getContext()) {
            if ("text".equals(contextBean.getType())) {
                helper.setText(R.id.fu_pin_cun_txt2, contextBean.getText());
            }
        }
    }
}
